package com.hopes.bizz.poll.analy.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @author lyb
 * @version 1.0
 * @description: 同比分析业表单对象
 * @date 2023/10/10 14:18
 */
@Getter
@Schema(description = "同比分析表单对象")
@EqualsAndHashCode(callSuper = false)
public class CompareAnalysisVo implements Serializable {

    private static final long serialVersionUID = -1713193962655851883L;

    /**
     * 因子名称
     **/
    @Setter
    private List<String> factor;

    /**
     * 分析数据
     **/
    private CompareAnalysisData analysisData;

    /**
     * 同比数据
     **/
    private CompareAnalysisData compareData;

    public void setAnalysisDataVal(List<Double> data) {
        if (Objects.isNull(analysisData)) {
            analysisData = new CompareAnalysisData();
        }
        analysisData.setData(data);
    }

    public void setCompareDataVal(List<Double> data) {
        if (Objects.isNull(compareData)) {
            compareData = new CompareAnalysisData();
        }
        compareData.setData(data);
    }

    public void setAnalysisDataName(String name) {
        if (Objects.isNull(analysisData)) {
            analysisData = new CompareAnalysisData();
        }
        analysisData.setName(name);
    }

    public void setCompareDataName(String name) {
        if (Objects.isNull(compareData)) {
            compareData = new CompareAnalysisData();
        }
        compareData.setName(name);
    }
}
